import type { YuSuan } from '@/types/count'
import type { Base2UserGroupRequest, BaseRequest } from '@/types/job'
import type { LoginResult } from '@/types/member'
import type {
  GetUserGoodsTypeRequest,
  GetUserGoodsTypeResponse,
  GetUserTagTypeRequest,
  GetUserTagTypeResponse,
  UpdateTagType1Request,
  UpdateUserGoodsType1Request,
  UpdateYuSuanRequest,
} from '@/types/note'
import { http } from '@/utils/http'

export type LoginParams = {
  UserName: string
  Pwd: string
}
export type RegistRequest = {
  UserName: string
  Pwd: string
  Pwd2: string
  Token: string
}
/**
 * 传统登录-用户名+密码
 * @param data 请求参数
 */
export const postLoginAPI = (data: LoginParams) => {
  return http<LoginResult>({
    method: 'POST',
    url: '/User/Login',
    data,
  })
}
export const postRegistAPI = (data: RegistRequest) => {
  return http<{}>({
    method: 'POST',
    url: '/User/Regist',
    data,
  })
}
export const GetYuSuanAPI = (data: Base2UserGroupRequest) => {
  return http<YuSuan>({
    method: 'POST',
    url: '/YuSuan/GetYuSuan',
    data,
  })
}
export const UpdateYuSuanAPI = (data: UpdateYuSuanRequest) => {
  return http<{}>({
    method: 'POST',
    url: '/YuSuan/UpdateYuSuan',
    data,
  })
}
export const GetUserGoodsTypeAPI = (data: GetUserGoodsTypeRequest) => {
  return http<GetUserGoodsTypeResponse[]>({
    method: 'POST',
    url: '/GoodType/GetUserGoodsType',
    data,
  })
}
export const GetUserTagTypeAPI = (data: GetUserTagTypeRequest) => {
  return http<GetUserTagTypeResponse[]>({
    method: 'POST',
    url: '/Tag/GetTagType',
    data,
  })
}
export const UpdateUserGoodsType = (data: GetUserGoodsTypeResponse[]) => {
  return http<{}>({
    method: 'POST',
    url: '/GoodType/UpdateUserGoodsType',
    data,
  })
}
export const UpdateUserTagType = (data: GetUserTagTypeResponse[]) => {
  return http<{}>({
    method: 'POST',
    url: '/Tag/UpdateUserTagType',
    data,
  })
}
export const AddUserGoodsType = (data: GetUserGoodsTypeResponse) => {
  return http<{}>({
    method: 'POST',
    url: '/GoodType/AddUserGoodsType',
    data,
  })
}
export const AddUserTagType = (data: GetUserTagTypeResponse) => {
  return http<{}>({
    method: 'POST',
    url: '/Tag/AddUserTagType',
    data,
  })
}
export const UpdateUserGoodsType1 = (data: UpdateUserGoodsType1Request) => {
  return http<{}>({
    method: 'POST',
    url: '/GoodType/UpdateUserGoodsType1',
    data,
  })
}
export const UpdateTagType1 = (data: UpdateTagType1Request) => {
  return http<{}>({
    method: 'POST',
    url: '/Tag/UpdateTagType1',
    data,
  })
}
